﻿using Avalonia.Controls;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System.Collections.Generic;

namespace WeChat.ViewModels;

public partial class MainViewModel : ViewModelBase
{
    private static readonly Dictionary<string, UserControl> Pages = new();

    [ObservableProperty] private object? _content;

    public RowDefinitions RowDefinitions { get; private set; }

    public MainViewModel()
    {
        Content = new ChatPage();
        Pages.Add("TabBarChat", (ChatPage)Content);
        Pages.Add("TabBarContacts", new ContactsPage());
        Pages.Add("TabBarFavorites", new FavoritesPage());
    }

    [RelayCommand]
    private void OnSelected(string name)
    {
        Content = Pages[name];
    }
}